package com.auxgroup.hr.front.dao.repository;

import com.auxgroup.hr.front.dao.domain.PsCModAttT;
import com.auxgroup.hr.front.dao.domain.PsCModAttTPrimary;
import com.auxgroup.hr.front.dao.domain.PsContractData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by nitongqian on 2019/1/18.
 */
@Repository
public interface PsCModAttTRepository extends
        JpaRepository<PsCModAttT,PsCModAttTPrimary>,JpaSpecificationExecutor<PsCModAttT> {

    List<PsCModAttT> findByCTransactionNbr(String tranNbr);

    @Query("select max(seqnbr) from PsCModAttT u where u.cTransactionNbr=:cTransactionNbr and u.cStepNbr=:cStepNbr and u.cUserNbr=:cUserNbr")
    BigDecimal getMaxSeqNbr(@Param("cTransactionNbr") String cTransactionNbr,@Param("cStepNbr") BigDecimal cStepNbr,@Param("cUserNbr") BigDecimal cUserNbr);
}
